package nabaixin.com.net.protocol;

import nabaixin.com.utils.Cache;
import nabaixin.com.utils.Constant;
import android.content.Context;
import android.util.Log;

public class GetNeighborsByLocationProtocol extends BaseProtocol {
	private static final String TAG = "GetUsersProtocol-->";
	
	private String cellid;
	private String lac;
	private String mnc;
	
	private String packedStr;
	private String encodeStr;
	
	public GetNeighborsByLocationProtocol(String cellid, String lac, String mnc) {
		this.cellid = cellid;
		this.lac = lac;
		this.mnc = mnc;
	}

	@Override
	public void packData() {
		//QNUSR-CEL [TRID] 100 cellid=xxx&lac=xxx&mnc=xxx&limit=n
		StringBuffer sb = new StringBuffer();
		sb.append("QNUSR-CEL ").append(Constant.TRID_GETNEIGHBORS).append(" 100 ")
			.append("cellid=").append(cellid)
			.append("&lac=").append(lac)
			.append("&mnc=").append(mnc)
			.append("&limit=").append(Cache.maxUsers)
			.append("&range=").append(Cache.maxDistanse);
		packedStr = sb.toString();
		Log.d(Constant.TAG, TAG+packedStr);
	}

	@Override
	public void excute(Context context) {
		encodeStr = encodeData(packedStr, TAG);
		sendData(context, encodeStr);
	}

}
